import router from '@system.router';

export default {
    data: {
        flag: { //菜单的默认索引
            default: 0
        },
        iconList:[{
                        thumb_up:"/common/images/icon_dianzan.png",
                        thumb_up_active:"/common/images/icon_dianzan_active.png",
                        comment:"/common/images/icon_comment.png",
                        share:"/common/images/icon_share.png"
                  }
        ],
        videoList: [{
                        url: '/common/video_1.mp4'
                    }, {
                        url: '/common/video_2.mp4'
                    }, {
                        url: '/common/video_3.mp4'
                    }, {
                        url: '/common/video_4.mp4'
                    }],
        commentList: [{
                          name: "我",
                          comment: "挑战DIY HarmonyOS视频播放器。",
                          image: '/common/images/p1.jpeg'
                      },
                      {
                          name: "dfeawrd",
                          comment: "HDC2021，我来了！",
                          image: '/common/images/p2.jpeg'
                      },
                      {
                          name: "efxdcxrf",
                          comment: "HarmonyOS，加油，go go go！",
                          image: '/common/images/p3.jpeg'
                      },
                      {
                          name: "ewrdvcxref",
                          comment: "支持支持！！！",
                          image: '/common/images/p4.jpeg'
                      },
                      {
                          name: "cxvdrger",
                          comment: "严重支持一波~~",
                          image: '/common/images/p5.jpeg'
                      },
                      {
                          name: "vrefcdvg",
                          comment: "一起冲，我看这架势，继续冲！",
                          image: '/common/images/p6.jpeg'
                      },
                      {
                          name: "hrdgraerg",
                          comment: "期待在HDC2021看到鸿蒙的新版本！",
                          image: '/common/images/p7.jpeg'
                      },
                      {
                          name: "ewarfegbdfwe",
                          comment: "昨天晚上升级了鸿蒙系统，非常好用。",
                          image: '/common/images/p8.jpeg'
                      }

        ],
        playIndex: 0,
        isStart : false,
        showCommentFlag: false,
        commentInfo: ''
    },
    changeVideo(obj) {
        this.isStart = false;
        this.$element(`videoId${this.playIndex}`).pause();
        this.playIndex = obj.index
        this.showComment = false
        this.commentInput = ''

        this.$element(`videoId${this.playIndex}`).start();
        this.isStart = true;
    },
    showComment() {
        this.showCommentFlag = true
    },
    changeStartOrPause:
    function () {
        if (this.showCommentFlag) {
            this.showCommentFlag = false
            return
        }

        if (this.isStart) {
            this.$element(`videoId${this.playIndex}`).pause();
            this.isStart = false;
        } else {
            this.$element(`videoId${this.playIndex}`).start();
            this.isStart = true;
        }
    },
    sendConmment() {
        this.commentList.push({
            name: '我',
            comment: this.commentInfo,
            image: '/common/images/p1.jpg'
        })
        this.commentInfo = ''
    },
    commentInfoChange(e) {
        this.commentInfo = e.value
    },
    distributeVideo: async function () {
        let actionData = {};
        let target = {
            bundleName: "com.example.harmonyos_wechat",
            abilityName: "com.example.harmonyos_wechat.MainAbility",
            data: actionData
        };

        let result = await FeatureAbility.startAbility(target);
        let ret = JSON.parse(result);
    },
    change(){
      if(this.flag == 0)
      {
          this.flag = 1;
      }
        else
            this.flag = 0;

    }
}